package com.jianyushe.mysqltest.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.jianyushe.mysqltest.entity.Teacher;
import com.jianyushe.mysqltest.mapper.TeacherMapper;
import com.jianyushe.mysqltest.service.ITeacherService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 教师表 服务实现类
 * </p>
 *
 * @author Alvin
 * @since 2022-05-08
 */
@Service
public class TeacherServiceImpl extends ServiceImpl<TeacherMapper, Teacher> implements ITeacherService {

    @Autowired
    TeacherMapper teacherMapper;

    public void test() {
        System.out.println("查询开始...");
        final List<Teacher> teachers = teacherMapper.selectList(null);

        System.out.println("查询结束...");
        teachers.forEach(System.out::println);
    }

    public void wrapperTest(){
        QueryWrapper<Teacher> wrapper = new QueryWrapper<>();
        wrapper.like("tname", "明");
        teacherMapper.selectList(wrapper);
    }
}
